import { TypeOrmModuleOptions } from "@nestjs/typeorm";

export const isDev = !!process.env.npm_package_name;

type MysqlType = "mysql" | "mariadb";
// mysql
export function getMysqlConf(): TypeOrmModuleOptions {
    return {
        type: process.env.MYSQL_TYPE as MysqlType || "mysql",
        host: process.env.MYSQL_HOST,
        port: parseInt(process.env.MYSQL_PORT) || 3306,
        username: process.env.MYSQL_USER,
        password: process.env.MYSQL_PASSWORD,
        database: process.env.MYSQL_DATABASE,
        synchronize: true,
        retryDelay: 500,
        autoLoadEntities: true
    };
}

